import Vue from 'vue'
import VueRouter from 'vue-router'
import MyDiscover from '@/views/MyDiscover'
import MyFriends from '@/views/MyFriends'
import MyMine from '@/views/MyMine'
import NotFound from '@/views/NotFound'

// 导入二级路由对应的组件
import TuiJian from '@/views/TuiJian'
import GeDan from '@/views/GeDan'
import PaiHangBang from '@/views/PaiHangBang'

Vue.use(VueRouter)

const routes = [
  {
    name: 'MyDiscover',
    path: '/',
    component: MyDiscover,
    // 给发现加的子路由
    children: [
      // 二级路由不要加`/`
      { name: 'TuiJian', path: 'tuijian',  component: TuiJian },
      { name: 'GeDan', path: 'GeDan',  component: GeDan },
      { name: 'PaiHangBang', path: 'PaiHangBang',  component: PaiHangBang },
    ]
  },
  { name: 'MyFriends', path: '/friend', component: MyFriends },
  { name: 'MyMine', path: '/my', component: MyMine },

  // *代表所有（除了上面以外的所有路径）-- 404页面规则要写到最后规定
  { name: 'NotFound', path: '*', component: NotFound }
]

const router = new VueRouter({
  routes
})

export default router
